<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <!-- 避免IE使用兼容模式 -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>项目管理</title>
    <script type="text/javascript" src="./../../../static/js/include/_include-css.js"></script>

</head>

<body class="bg-gray">
    <div class="wrapper">
        <div class="wrapper-container">
            <div class="row">
                <div class="col-md-12 ">
                    <div class="search-panel">
                        <form id="search-form">
                            <div class="select-list">
                                <ul>
                                    <li>
                                        项目编号：<input type="text" />
                                    </li>
                                    <li>
                                        项目名称：<input type="text" />
                                    </li>
                                    <li>
                                        开始日期: <input class="time-input" data-type="date" readonly="" type="text">
                                    </li>
                                    <li>
                                        结束日期：<input class="time-input" data-type="date" readonly="" type="text">
                                    </li>
                                    <li>
                                        项目状态：<select name="status" class="select2">
                                            <option value="">请选择状态</option>
                                            <option value="1">正常</option>
                                            <option value="2">延期</option>
                                            <option value="0">竣工</option>
                                        </select>
                                    </li>
                                    <li>
                                        <a class="btn btn-primary btn-round btn-sm btn-search-submit"
                                            onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                        <a class="btn btn-warning btn-round btn-sm btn-search-reset"
                                            onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                                    </li>
                                </ul>
                            </div>
                        </form>
                    </div>
                </div>
                <div class="btn-group-sm" id="toolbar" role="group">
                    <a class="btn btn-primary btn-list-top-add" onclick="$.operate.addTab()">
                        <i class="fa fa-plus"></i> 新增项目
                    </a>
                </div>
                <div class="col-md-12 select-table">
                    <div class="panel">
                        <div class="panel-body-sm">
                            <table id="bootstrap-table"></table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript" src="./../../../static/js/include/_include-js.js"></script>

    <script type="text/javascript">

        function projectView(style) {
            $.modal.openTab("项目详情风格" + style, "./../../../pages/examples/pages/project_view"+ style +".html");
        }

        $(function () {
            var options = {
                url: "./../../../static/data/project_list.json",
                method: 'get',
                modalName: '项目信息',
                createUrl: "./../../../pages/examples/pages/project_add.html",
                showSearch: true,
                showRefresh: true,
                showToggle: true,
                showColumns: true,
                clickToSelect: true,
                sidePagination: 'client',
                columns: [{
                    checkbox: true
                },
                {
                    title: '序号',
                    width: 5,
                    align: "center",
                    formatter: function (value, row, index) {
                        return $.table.serialNumber(index);
                    }
                },
                {
                    field: 'code',
                    title: '项目编号'
                },
                {
                    field: 'name',
                    title: '项目名称'
                },
                {
                    field: 'manager',
                    title: '项目经理'
                },
                {
                    field: 'phone',
                    title: '联系电话'
                },
                {
                    field: 'startTime',
                    title: '开工日期'
                },
                {
                    field: 'endTime',
                    title: '竣工日期'
                },
                {
                    field: 'company',
                    title: '施工单位'
                },
                {
                    field: 'customer',
                    title: '投标公司'
                },
                {
                    field: 'status',
                    title: '项目状态',
                    formatter: function (value, row, index) {
                        if (value == 1) {
                            return '<label class="label label-primary">正常</label>';
                        } else if (value == 2) {
                            return '<label class="label label-danger">延期</label>';
                        } else if (value == 0) {
                            return '<label class="label label-success">竣工</label>';
                        }
                    }
                },
                {
                    field: 'progress',
                    title: '当前进度',
                    formatter: function (value, row, index) {
                        var progress = value * 100;
                        var progressBox = $('<div class="progress progress-xs">');
                        var progressBar = $('<div style="width:' + progress + '%" class="progress-bar ">');
                        progressBox.append(progressBar);
                        console.info(progressBox.html);
                        return progressBox.prop("outerHTML");
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-info btn-xs" href="#" onclick="projectView(1)"><i class="fa fa-eye"></i>详情1</a> ');
                        actions.push('<a class="btn btn-info btn-xs" href="#" onclick="projectView(2)"><i class="fa fa-eye"></i>详情2</a> ');
                        actions.push('<a class="btn btn-info btn-xs" href="#" onclick="projectView(3)"><i class="fa fa-eye"></i>详情3</a> ');
                        actions.push('<a class="btn btn-primary btn-xs" href="#" onclick=""><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs" href="#"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>

</html>